﻿using System.Web;
using ContactCenter.Core.ObjectModel;
using StructureMap;
using StructureMap.Configuration.DSL;

namespace ContactCenter.UI.Web.Extensibility
{
    public class StartupRegistry : Registry
    {
        public StartupRegistry()
        {
            Scan(s=>
                     {
                         s.IgnoreStructureMapAttributes();
                         s.AddAllTypesOf(typeof(IBootstrapperJob));
                         s.AddAllTypesOf(typeof(IHttpModule));
                         s.ConnectImplementationsToTypesClosing(typeof(IConfigurationTask<>));
                         s.ModifyGraphAfterScan(c=>c.PluginFamilies.Each(x=> x.SetScopeTo(InstanceScope.Singleton)));
                         s.AssembliesFromApplicationBaseDirectory();
                     });
        }
    }
}